'''
    while 循环
    for 循环

    break:终止循环
    continue: 跳过当前循环继续下次循环
    return: 终止循环
'''

i =10
while i < 10: # 死循环
    print("hello")
    i=i+1

# 打印九行九列矩形 -> 三角形 —> 乘法表
j=1
while j < 10:
    m = 1
    while m <= j:
        print("%d*%d=%d "%(m,j,m*j),end="")
        m=m+1
    j=j+1
    print()

resultSum = 0
i = 1
while i<=100:
    if i % 2 == 0:
        resultSum += i
    i += 1
print(resultSum)


# 遍历容器 像字符串 列表 集合...

str1 = "hello world!"

alist = [0,10,12,45,78979,5421,2,54,4,54,66]
#直接遍历对象本身
for i in str1:
    print(i)

for i in alist:
    print(i)

#指定区间遍历
for i in range(0,10):
    print(i)

for i in range(0,10,2):
    print(i)

for i in range(10,0,-1):
    print(i)

for i in range(0,len(str1)):
    print(i)
    print(str1[i])

resultSum2=0
for i in range(1,101):
    if i % 2 != 0:
        resultSum2 +=i
print(resultSum2)

for i in range(1,10):
    for j in range(1,i+1):
        print("%d*%d=%d "%(j,i,i*j),end="")
    print("")





